#pragma once
#include <string>

#ifdef  UTILITY_EXPORTS
#define UTINITY_DLL extern"C" _declspec(dllexport)
#else
#define UTINITY_DLL extern"C" _declspec(dllimport)
#endif



/************************************************************************/
/* FUNC FOR FILES                                                       */
/************************************************************************/
UTINITY_DLL HANDLE MyLockFile(LPCSTR strFile);
UTINITY_DLL void   MyUnlockFile(HANDLE hFile);

UTINITY_DLL char* GetCurrentDir(const char* szCurFile, char* szCurDir, int nSize);
UTINITY_DLL BOOL  IsFileExist(const char* pszFileName);
UTINITY_DLL BOOL  DeleteDir(LPCSTR strDir);
UTINITY_DLL BOOL  IsDirectory(LPCSTR strDir);
UTINITY_DLL BOOL  DirectoryExists(LPCSTR lpszPath);
UTINITY_DLL BOOL  EnsurePathExists(LPCSTR lpszPath);


UTINITY_DLL HANDLE MyCreateFile(
								LPCSTR lpFileName,
								DWORD dwDesiredAccess,
								DWORD dwShareMode,
								LPSECURITY_ATTRIBUTES lpSecurityAttributes,
								DWORD dwCreationDisposition,
								DWORD dwFlagsAndAttributes,
								HANDLE hTemplateFile,
								int nInterval = 5, 
								int nRetry = 3);

/************************************************************************/
/* FUNC FOR TIME                                                        */
/************************************************************************/
UTINITY_DLL int  GetRandNumber(int nMin, int nMax);
UTINITY_DLL BOOL MyGetFileTime(const char* pszFileName, LPFILETIME lpFileTime);
UTINITY_DLL char* GetCurTime(char* pszTime, int nSize);


/************************************************************************/
/* FUNC FOR REG                                                         */
/************************************************************************/
UTINITY_DLL char* GetRegistryEntry(char* szRegEntry, int nSize);
UTINITY_DLL int   GetVPUID();
UTINITY_DLL char* GetWSPConfig(char* szConfig, int nSize);

UTINITY_DLL void WriteReconcileFlag();
UTINITY_DLL void ClearReconcileFlag();
UTINITY_DLL bool ReadyToReconcile();

struct LogConfig
{
	bool bLogAsync;

	bool bOutput;
	bool bOutputDebugView;
	bool bOutputFile;

	char szFileName[128];
	char szFullName[260];
	char szModuleName[26];

	int  nLogLevl;
	int  nLogViewLevl;

	int  LogHisLim;
};

const int LOG_TRACE		= 6;
const int LOG_DEBUG		= 5;
const int LOG_INFO		= 4 ;   // EVENTLOG_INFORMATION_TYPE
const int LOG_WARNING	= 2; // EVENTLOG_WARNING_TYPE
const int LOG_ERROR		= 1;    // EVENTLOG_INFORMATION_TYPE

/************************************************************************/
/* FUNC FOR LOGINFO                                                     */
/************************************************************************/
UTINITY_DLL void GetDefLogConfig(LogConfig* _option);
UTINITY_DLL BOOL MakeLogConfig(LogConfig* _option, const char* szFilePath, int nLogLevl, int nLogViewLevl, BOOL bOutput, BOOL bOutputDebugView, BOOL bOutputFile, int LogHisLim);
UTINITY_DLL void DoLogInfo(LogConfig* _option, const char* pszClassFunc, int logType, const char* pzFormat, ...);
UTINITY_DLL void SimpleLogInfo(LogConfig* _option, int logType, const char* pzFormat, ...);


UTINITY_DLL void LogStart();
UTINITY_DLL void LogStop();